<%@ include file="include.jsp" %>

<h3>Add Dormitory</h3>
<!-- model attribute = model object we are calling -->
<form:form action="saveNewDormitory.html" modelAttribute="newDorm">

<!-- path="name" = method on the model object -->
Name: <form:input path="name" /><br><form:errors path="name" cssClass="error" />
<br>
Note: <form:textarea path="note" />
<br>
Male: <form:radiobutton path="male" value="true" />
Female: <form:radiobutton path="male" value="false" />
<br>
Dormitory has air conditioning? Yes: <form:radiobutton path="hasAirCondition" value="true" />  No: <form:radiobutton path="hasAirCondition" value="false" />
<br>
Is the Dormitory Handicap Accessible? Yes: <form:radiobutton path="handicapAccessible" value="true" /> No: <form:radiobutton path="handicapAccessible" value="false" />
<br>
Continental Breakfast Included with Stay: Yes: <form:radiobutton path="includesContinentalBreakfast" value="true" /> No: <form:radiobutton path="includesContinentalBreakfast" value="true" />
<br>
<c:if test='${not empty newDorm.roomList}'>
   <ul>
      <c:forEach var="room" items="${newDorm.roomList}" varStatus="status">
         <li>Room Number: <form:input path="roomList[${status.index}].number" /></b>
         	<br>Total beds: <form:input path="roomList[${status.index}].sizeLimit" />
         </li>
      </c:forEach>
   </ul>
</c:if>

<input type="submit" name="submit" value="Add Room">
<br>
<input type="submit" name="submit" value="Submit">

</form:form>

